<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/vectrics.tld" prefix="vectrics" %>

<%@page import="org.vectrics.hibernate.ThreadProperties"%>

<%
    String locationId = null;
	if (request.getAttribute("locationId")!= null) {
        locationId= (String)request.getAttribute("locationId");
	}
	String companyPersonId = request.getParameter("companyPersonId");
	String newDomainOptionStr = (String)request.getAttribute("newDomainOption");
	boolean newDomainOption = newDomainOptionStr.equals("true");
	String domainId = ThreadProperties.getDomain().getId().toString();
%>


<jsp:useBean id="companyForm" class="org.vectrics.company.web.struts.CompanyForm" scope="request"/>


<vectrics:errors debug="false"/>
<html:form action="/admin/company/save" method="POST"  focus="name">
	<html:hidden property="companyId"/>
	<html:hidden property="parentId"/>
	
	<table>
		<tr>
			<td class="formBg1" valign="middle" width="150">
				<font class="formLabelClass">Company Name</font>
				<vectrics:errors property="name"/>
			</td>
			<td class="formBg1" valign="top">
				<html:text property="name" styleClass="formEditClass" maxlength="40"/>
			</td>
		</tr>
		
		<tr>
			<td class="formBg2" valign="middle" width="150">
				<font class="formLabelClass">Reference ID</font>
				<vectrics:errors property="referenceId"/>
			</td>
			<td class="formBg2" valign="top">
				<html:text property="referenceId" styleClass="formEditClass" maxlength="25"/>
			</td>
		</tr>

		<tr>
			<td class="formBg1" valign="middle"><font class="formLabelClass"><bean:message key="prompt.company.sector"/></font></td>
			<td class="formBg1" valign="top">
				<html:select name="companyForm" property="sectorCode" styleClass="formComboClass">
				  <html:options collection="sectors" labelProperty="description" property="code"/>
				</html:select>
			</td>
		</tr>

		
		<tr>
			<td class="formBg2" valign="middle" width="150">
				<font class="formLabelClass">Phone</font>
			</td>
			<td class="formBg2" valign="top">
				<html:text property="phone" styleClass="formEditClass" maxlength="18"/>
			</td>
		</tr>
		<tr>
			<td class="formBg1" valign="middle" width="150">
				<font class="formLabelClass">Phone 2</font>
			</td>
			<td class="formBg1" valign="top">
				<html:text property="phone2" styleClass="formEditClass" maxlength="18"/>
			</td>
		</tr>

		<tr>
			<td class="formBg2" valign="middle" width="150">
				<font class="formLabelClass">Address 1</font>
			</td>
			<td class="formBg2" valign="top">
				<html:text property="address1" styleClass="formEditClass" maxlength="30"/>
			</td>
		</tr>

		<tr>
			<td class="formBg1" valign="middle" width="150">
				<font class="formLabelClass">Address 2</font>
			</td>
			<td class="formBg1" valign="top">
				<html:text property="address2" styleClass="formEditClass" maxlength="30"/>
			</td>
		</tr>

		<tr>
			<td class="formBg2" valign="middle" width="150">
				<font class="formLabelClass">Postal Code</font>
				<vectrics:errors property="postalCode"/>
			</td>
			<td class="formBg2" valign="top">
				<html:text property="postalCode" styleClass="formEditClass" maxlength="16"/>
			</td>
		</tr>

		<tr>
			<td class="formBg1" valign="middle">
				<font class="formLabelClass"><bean:message key="prompt.city"/></font>
			</td>
			<td class="formBg1" valign="top">
                  <vectrics:locationCombo 
					property="locationId" 
					locationType="job.location"
					domainId="<%=domainId%>"
                    selected="<%=locationId%>"
					styleClass="formComboClass" />
            </td>
		<tr>

		<tr>
			<td class="formBg2" valign="top" width="150">
				<font class="formLabelClass"><bean:message key="prompt.company.job.background"/></font>
				<vectrics:errors property="background"/>
			</td>
			<td class="formBg2" valign="top">
				<html:textarea rows="8" property="background" style="font-family:verdana,arial,sans serif;font-size=10px" cols="80" styleClass="formTextAreaClass"/>
			</td>
		</tr>


	<% if (newDomainOption) { %>
		<tr>
			<td class="formBg1" valign="top">
				<font class="formLabelClass"><bean:message key="prompt.company.create.domain"/></font>
				<vectrics:errors property="featured"/>
			</td>
			<td class="formBg1" valign="top">
				<html:checkbox property="createDomain"/>
			</td>
		</tr>
	<% } %>

		<tr>
			<td valign="TOP" align="left"></td>
			<td valign="TOP" align="left">
				<vectrics:formButton code="button.ok" phraseCode="button.ok" elementId="ok.btn" value="submit" name="submit"/>
				&nbsp;
				<vectrics:formButton code="button.cancel" phraseCode="button.cancel" elementId="cancel.btn" value="cancel" name="cancel"/>
			</td>
		</tr>
	</table>
</html:form>
